float4x4 gWorld;
float4x4 gView;
float4x4 gProjection;

float gOffset;

texture2D gDiffuse;
texture2D gAlpha;

SamplerState samAnisotropic
{
	MinFilter = ANISOTROPIC;
	MagFilter = ANISOTROPIC;
	MipFilter = linear;
	AddressU = Wrap;
	AddressV = Wrap;
};

struct VS_IN
{
	float4 Position : POSITION;
	float2 texCoord : TEXCOORD;
};

struct VS_OUT
{
	float4 Position : POSITION;
	float2 texCoord : TEXCOORD;
};

VS_OUT VS(VS_IN input)
{
	VS_OUT output;

	float4 worldPosition = mul(input.Position, gWorld);
	float4 viewPosition = mul(worldPosition, gView);
	output.Position = mul(viewPosition, gProjection);

	output.texCoord = input.texCoord;

	return output;
}

float4 PS(VS_OUT input) : COLOR
{
	//Add offset to texCoord
	float2 texCoord = input.texCoord;
	texCoord.x += gOffset;

	//Get Alpha & Color
	float3 color = gDiffuse.Sample(samAnisotropic, texCoord).rgb;
	float alpha = gAlpha.Sample(samAnisotropic, texCoord).r;

	//Return tex
	return float4(color, 1.0f);
}

technique TextureColor
{
	pass P0
	{
		VertexShader = compile vs_3_0 VS();
		PixelShader = compile ps_3_0 PS();
	}
}
